﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Telerik.Windows.Controls;
using System.Collections.ObjectModel;
using TreeListView.WPF.Model;
using TreeListView.WPF.DataProvider;

namespace TreeListView.WPF.ViewModel
{
    public class FirstLookViewModel : ViewModelBase
    {
        ObservableCollection<HierarchicalDocumentItem> _documentItems;

        public ObservableCollection<HierarchicalDocumentItem> DocumentItems
        {
            get
            {
                if (_documentItems == null)
                {
                    var dataSource = FakeFactory.GetDocumentItems();

                    _documentItems = new ObservableCollection<HierarchicalDocumentItem>(from x in dataSource where x.ParentID == Guid.Empty select new HierarchicalDocumentItem(x.ID, x.ParentID, x.Number, x.Description, dataSource));
                }

                return _documentItems;
            }
        }
    }
}
